from haystack.indexes import SearchIndex
from haystack.indexes import Indexable
from haystack.indexes import CharField

from common.models import HouseInfo


class HouseInfoIndex(SearchIndex, Indexable):

    detail = CharField(document=True)

    def get_model(self):
        return HouseInfo

    def index_queryset(self, using=None):
        return self.get_model().objects.filter(is_launched=True)
